<?php

namespace App\Console\Commands;

use App\Exceptions\BizException;
use App\Jobs\ChangeOrderJob;
use App\RiskOrder;
use App\RiskRule;
use App\RiskRuleAli;
use App\Services\RuleService;
use App\Services\VerifyService;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use think\api\Client;

class Test extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'test';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '测试';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }





    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $list = RiskOrder::where('orderid',14942)->first();

        $rule_service = new RuleService();
        $rule_service->getAllBairong($list);
        exit;

//        $list = RiskOrder::where('is_curtail',0)->get();
//        /** @var RiskOrder $order */
//        foreach ($list as $order){
//            $order->is_curtail = 1;
//            $order->openid = DB::table('ims_ewei_shop_order')->where('id',$order->orderid)->value('openid');
//            $order->save();
//            var_dump($order->id);
//        }
//        exit;

        $list = RiskOrder::where('orderid',14942)->first();
        var_dump($list->id);
        $rule_service = new RuleService();
        $rule_service->updateLevel($list);

        exit;
        $list = RiskOrder::whereId(2624)->get();
        $rule_service = new RuleService();
        foreach ($list as $val){
            $rule_service->updateLevel($val);
        }

        exit;
        $list = DB::table('ims_ewei_shop_order_detail')->where('id','>',10930)
            ->where('is_risk',0)
            ->whereNotNull('bairong_report')
            ->update(['is_risk'=>1]);

        var_dump($list);
        exit;
        $val = '5000- 7000';
        var_dump(strpos($val,' '));
        if(!empty($val) && strpos(' ',$val) !== false){
            var_dump(666);
           $a = str_replace(' ','',$val);
           var_dump($a);
        }

        exit;
        $data = [
//            'money' => '1000-2000&>=,7000',
//            'age' => '18-20|48-50|',
            'courtdetail' => 'shixin,>=,0.65',
            'c3'=>'d3.id.allnum,>=,9|d3.cell.allnum,>=,9',
            'fxsb' => 'qsyc,>=,90&xfxwyc,>=,90&lyyy,>=,90',
            'jdyxyz' => 'm3.id.nbank.allnum,>=,20',
        ];
        $a = RiskRule::conversionData($data);

        var_dump($a);
    }
}
